<%- include header %>
<% arts.forEach(function(art) {%>

	<div class="article">
		<!-- 显示标题 -->
		<a href="/u/<%= art.author %>/<%= art._id %>">
			<h1><%= art.title %></h1>
		</a>
		<!-- 显示作者，粗体 -->
		<p>
			<span class="author">
				<span class="text-bold">作者： </span>
				<a href="/u/<%= art.author%>"><%= art.author %></a>
				<!-- <%= art.author %> -->
			</span> |
			<!-- 显示时间 -->
			<span class="create-time">
				<span class="text-bold">时间： </span>
				<%= moment(art.createTime).locale('zh-cn').format('LL HH:mm:ss')%>
			</span> |
			<!-- 显示标签 -->
			<span class="label label-info"><%= art.tag %></span>
		</p>
		<!-- 显示内容 -->
		<p><%= art.content%></p>
		
	</div>

<% }); %>

<!-- 导航栏-->
<nav>
	<ul class="pager">
		<% if (!isFirstPage) {%>
			<!-- 如果不是第一页，显示第一页和上一页的箭头及标识 -->
			<li>
				<a href="?search=<%= search %>&page=1">
					<span aria-hidden="true">首页</span>
				</a>
			</li>

			<li>
				<a href="?search=<%= search %>&page=<%= page -1 %>" aria-label="Previous">
					<span aria-hidden="true">&laquo;上一页</span>
				</a>
			</li>
		<% } %>
		<!-- 如果不是最后页，显示下一页和末页 -->
		<% if (!isLastPage) {%>
			<li>
				<a href="?search=<%= search %>&page=<%= page+1%>" aria-label="Next">
					<span aria-hidden="true">下一页 &raquo;</span>
				</a>
			</li>
			<li>
				<a href="?search=<%= search %>&page=<%= Math.ceil(total/pageSize) %>">
				<span aria-hidden="true">末页</span>	
				</a>				
			</li>
		<% } %>
		
		
	</ul>
</nav>

<div id="pagination-box"></div>

<div id="blog-data"
total="<%= total %>"
search="<%= search %>"
page="<%= page %>"
pageSize="<%= pageSize %>"
isFirstPage="<%= isFirstPage %>"
isLastPage="<%= isLastPage %>"	>
</div>
<script src="/view-js/pagination.js"></script>

<%- include footer %>
